All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.text.EditorKit

java.lang.Object
   |
   +----com.sun.java.swing.text.EditorKit

public abstract class EditorKit
extends Object
implements Cloneable, Serializable
Establishes the set of things needed by a text component to be a reasonably functioning editor for some type of text content. The EditorKit acts as a factory for some kind of policy. For example, an implementation of html and rtf can be provided that is replaceable with other implementations.

A kit can safely store editing state as an instance of the kit will be dedicated to a text component. New kits will normally be created by cloning a prototype kit. The kit will have it's setComponent method called to establish it's relationship with a JTextComponent.


Constructor Index

 o EditorKit()

Method Index

 o clone()
Creates a copy of the editor kit.
 o createCaret()
Fetches a caret that can navigate through views produced by the associated ViewFactory.
 o createDefaultDocument()
Creates an uninitialized text storage model that is appropriate for this type of editor.
 o deinstall(JEditorPane)
Called when the kit is being removed from the JEditorPane.
 o getActions()
Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.
 o getContentType()
Gets the MIME type of the data that this kit represents support for.
 o getViewFactory()
Fetches a factory that is suitable for producing views of any models that are produced by this kit.
 o install(JEditorPane)
Called when the kit is being installed into the a JEditorPane.
 o read(InputStream, Document, int)
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
 o read(Reader, Document, int)
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
 o write(OutputStream, Document, int, int)
Writes content from a document to the given stream in a format appropriate for this kind of content handler.
 o write(Writer, Document, int, int)
Writes content from a document to the given stream in a format appropriate for this kind of content handler.

Constructors

 o EditorKit
 public EditorKit()

Methods

 o clone
 public abstract Object clone()
Creates a copy of the editor kit. This allows an implementation to serve as a prototype for others, so that they can be quickly created.

Returns:
the copy
Overrides:
clone in class Object
 o install
 public void install(JEditorPane c)
Called when the kit is being installed into the a JEditorPane.

Parameters:
c - the JEditorPane
 o deinstall
 public void deinstall(JEditorPane c)
Called when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached.

Parameters:
c - the JEditorPane
 o getContentType
 public abstract String getContentType()
Gets the MIME type of the data that this kit represents support for.

Returns:
the type
 o getViewFactory
 public abstract ViewFactory getViewFactory()
Fetches a factory that is suitable for producing views of any models that are produced by this kit.

Returns:
the factory
 o getActions
 public abstract Action[] getActions()
Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.

Returns:
the set of actions
 o createCaret
 public abstract Caret createCaret()
Fetches a caret that can navigate through views produced by the associated ViewFactory.

Returns:
the caret
 o createDefaultDocument
 public abstract Document createDefaultDocument()
Creates an uninitialized text storage model that is appropriate for this type of editor.

Returns:
the model
 o read
 public abstract void read(InputStream in,
                           Document doc,
                           int pos) throws IOException, BadLocationException
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.

Parameters:
in - The stream to read from
doc - The destination for the insertion.
pos - The location in the document to place the content >= 0.
Throws: IOException
on any I/O error
Throws: BadLocationException
if pos represents an invalid location within the document.
 o write
 public abstract void write(OutputStream out,
                            Document doc,
                            int pos,
                            int len) throws IOException, BadLocationException
Writes content from a document to the given stream in a format appropriate for this kind of content handler.

Parameters:
out - The stream to write to
doc - The source for the write.
pos - The location in the document to fetch the content from >= 0.
len - The amount to write out >= 0.
Throws: IOException
on any I/O error
Throws: BadLocationException
if pos represents an invalid location within the document.
 o read
 public abstract void read(Reader in,
                           Document doc,
                           int pos) throws IOException, BadLocationException
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.

Since actual text editing is unicode based, this would generally be the preferred way to read in the data. Some types of content are stored in an 8-bit form however, and will favor the InputStream.

Parameters:
in - The stream to read from
doc - The destination for the insertion.
pos - The location in the document to place the content >= 0.
Throws: IOException
on any I/O error
Throws: BadLocationException
if pos represents an invalid location within the document.
 o write
 public abstract void write(Writer out,
                            Document doc,
                            int pos,
                            int len) throws IOException, BadLocationException
Writes content from a document to the given stream in a format appropriate for this kind of content handler.

Since actual text editing is unicode based, this would generally be the preferred way to write the data. Some types of content are stored in an 8-bit form however, and will favor the OutputStream.

Parameters:
out - The stream to write to
doc - The source for the write.
pos - The location in the document to fetch the content >= 0.
len - The amount to write out >= 0.
Throws: IOException
on any I/O error
Throws: BadLocationException
if pos represents an invalid location within the document.

All Packages  Class Hierarchy  This Package  Previous  Next  Index